home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 436 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.7 KB  |  50 lines

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: wikman@research.nokia.com (Johan Wikman)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Problem with template overloading.
  5. Date: 22 Feb 1996 15:51:08 GMT
  6. Organization: ?
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <9602220718.AA11584@garlic.spices>
  9. NNTP-Posting-Host: taumet.eng.sun.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset="ISO-8859-1"
  12. Content-Transfer-Encoding: 8bit
  13. X-Mailer: ELM [version 2.4 PL24alpha5]
  14. X-Lines: 25
  15. Content-Length: 909
  16. Originator: clamage@taumet
  17.  
  18. In article <4gdc6v$cqv@engnews1.Eng.Sun.COM> clamage@Eng.sun.com (Steve Clamage) writes:
  19.  
  20.    Yes. Only in special cases would you not have insurmountable ambiguities.
  21.    Just as type names must be unique in one scope, so must template names.
  22.  
  23. I'd like to be able to have a class and a template with the same name
  24. in the same scope. 
  25.  
  26. Usually when I write a template, I derive it from a class that is only
  27. used as a base class of the template.   
  28.  
  29.     class BaseX { ... };
  30.     template<class T> class X : public BaseX { ... };
  31.  
  32. Consequently I must invent a descriptive name for the base class and
  33. usually I end up with Base-something or Abstract-something. I'd like
  34. to be able to write: 
  35.  
  36.     class X { ... };
  37.     template<class T> class X : public X { ... };
  38.  
  39. I don't think there would be ambiguities as an X without a template
  40. argument is the "class" X and an X with a template argument is
  41. obviously the "template" X. 
  42.  
  43.  
  44. [ To submit articles: Try just posting with your newsreader.
  45.               If that fails, use mailto:std-c++@ncar.ucar.edu
  46.   FAQ:    http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  47.   Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  48.   Comments? mailto:std-c++-request@ncar.ucar.edu
  49. ]
  50.